<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>组件的创建挂载顺序</title>
  <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.2.37/vue.global.js"></script>
</head>
<body>
  <div id="app">
    <h1>{{ message }}</h1>
    <parent></parent>
  </div>
</body>
<script>
  const { createApp } = Vue;
  createApp({
    data() {
      return {
        message: 'hello world'
      }
    },
    components: {
      parent: {
        name: 'parent',
        template: '<div>parent: <child /></div>',
        created() {
          console.log('parent created');
        },
        mounted() {
          console.log('parent mounted');
        },
        components: {
          child: {
            name: 'child',
            template: '<div>child</div>',
            created() {
              console.log('child created');
            },
            mounted() {
              console.log('child mounted');
            }
          }
        }
      }
    }
  }).mount('#app')

  // patch的多次递归嵌套
</script>
</html>